# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=rex
pkgver=729.d226d47
pkgrel=1
pkgdesc="Shellphish's automated exploitation engine, originally created for the Cyber Grand Challenge."
groups=('blackarch' 'blackarch-exploitation')
arch=('any')
url='https://github.com/shellphish/rex'
license=('BSD')
depends=('python2' 'python2-simuvex' 'python2-tracer' 'angr-py2' 'angrop')
makedepends=('git' 'python2-setuptools')
source=("git+https://github.com/shellphish/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python2 setup.py build
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  python2 setup.py install --root="$pkgdir" --skip-build

  cp -a tests "$pkgdir/usr/share/$pkgname/tests"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

